<template>
    <div class="header_container">
        <div class="content container">
            <h3 class="title"><span>宝藏</span>网站导航</h3>
            <p class="text">该网站收录了很多优秀并且实用的网站，不管你是设计、开发、文员或者其他，都能找到合适的网站，如果对您有所帮助，您也可以将您有的网站且本站未收录的发送给我。</p>
            <div class="contact_btn">
                <Contact @click=copyText></Contact>
                <img class="copy_img animate__animated animate__fadeOut" v-if="copySuccess" src="../assets/copy.png"
                    alt="copy">
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import Contact from './Contact.vue'
import { ref } from 'vue'
import clipboard3 from 'vue-clipboard3'

const { toClipboard } = clipboard3();

let copySuccess = ref(false) // 复制成功
let text = ref('15156090303')

const copyText = async () => {
    try {
        await toClipboard(text.value);
        copySuccess.value = true
        setTimeout(() => {
            copySuccess.value = false
        }, 500)
    } catch (error) {
        alert("复制失败")
    }
}
</script>

<style scoped lang="scss">
.header_container {
    width: 100%;
    height: 560px;
    background-image: url(../assets/banner.png);
    background-repeat: no-repeat;
    background-position: right;
    background-size: 80% 100%;
    background-color: #D3E3F9;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 40px;

    .content {
        .title {
            color: #17181B;
            font-size: 52px;
            font-weight: bold;
            letter-spacing: 6px;
            font-style: italic;

            span {
                color: #0B64FF;
            }
        }

        .text {
            color: #555;
            font-size: 18px;
            margin-top: 20px;
            width: 58%;
            text-align: justify;
            margin-bottom: 60px;
        }

        .contact_btn {
            display: flex;
            flex-direction: row;
            align-items: center;

            .copy_img {
                position: relative;
                width: 24px;
                height: 24px;
                margin-left: 16px;
            }
        }

    }

}
</style>